package com.zzc.emotisenseclassroom.controller.user;

import com.zzc.common.response.ZzcResponse;
import com.zzc.emotisenseclassroom.common.ResponseCodeEnum;
import com.zzc.emotisenseclassroom.domain.user.service.VerificationCodeService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright Zzc
 * FileName: VerificationCodeController
 * Author:   Zzc
 * Date:     2024/4/1523:49
 * Description:生成验证码控制器
 * hISTORY:
 * <author>  <time>     <version>    <desc>
 * 作者姓名   修改时间       版本号       描述
 * Zzc                   1.0.0
 */
@RequestMapping("/VerificationCode")
@RestController
public class VerificationCodeController {
    private static final Logger LOG = LogManager.getLogger(VerificationCodeController.class);

    @Autowired
    VerificationCodeService verificationCodeService;

    @GetMapping("/getVerificationCode")
    @ResponseBody
    public ZzcResponse getRandomValidateCode(HttpServletRequest request, HttpServletResponse response) {
        verificationCodeService.generateValidateCode(request, response);
        return ZzcResponse.success(ResponseCodeEnum.GENERATE_VALIDATE_CODE_SUCCESS);
    }
}
